template<class T>
void readInDeMeoCarry13(T myAst[], long indLastMPC, long indLastNumbMPC, string* ids, long nIds)
{
  char lineChar[255];
  ifstream myfile ("alluniq_Chr.dat");
  long ind;
  AsteroidWithPole ast;
  string line;

  if (myfile.is_open())
  {
    
    //    while (myfile.get(lineChar,226,10))
    //      {
    //	lineChar[224]=lineChar[225]=lineChar[226]=0;
    //	line.assign(lineChar);    
    while ( getline (myfile,line))
      {
	if (line.length()>1)
	  {
	    // convert linefile to asteroid
	    ast.DeMeoCarry13String2Asteroid(line);
	    //	    cout << ast.Number << " " << ast.Designation << " --> " << ast.tax << endl; cout.flush();
	    //	    ast.print(); fflush(stdout);
	    // if the asteroid is Numbered in the file assing it
	    if (ast.Number>0)
	      {
		memcpy(&myAst[ast.Number-1].taxClasses[20], &ast.taxClasses[20],3);
		myAst[ast.Number-1].hasTax=1;
		myAst[ast.Number-1].refs[6]+=DEMEOCARRY;
	      }
	    else
	      {
		//		cout << "unnumbered" << endl;
		// can you match is right there ?
		if ((ind = findUnnumberedAst(myAst,ast,indLastMPC,indLastNumbMPC+1))>=0) // YES ! 
		  {
		    //		    cout << "unnumbered matched with ind:" << ind << " designation " << myAst[ind].Designation << " " << myAst[ind].Number << endl;
		    memcpy(&myAst[ind].taxClasses[20],&ast.taxClasses[20],3);
		    myAst[ind].hasTax=1;
		    myAst[ind].refs[6]+=DEMEOCARRY;
		    //		    cout << "assigned tax" << endl;
		  }
		else
		  { // the designation could not be matched.
		    // try to see if the asteroid has been numbered LATER
		    ast.findId(ids,nIds);
		    if (ast.Number>0)
		      {
			//			cout << "cazzo " << ast.Number << " " << ast.Designation << " " << ast.pack << endl;
			memcpy(&myAst[ast.Number-1].taxClasses[20],&ast.taxClasses[20],3);
			myAst[ast.Number-1].hasTax=1;
			myAst[ast.Number-1].refs[6]+=DEMEOCARRY;
		      }
		    else
		      {
			if ((ind = findUnnumberedAst(myAst,ast,indLastMPC,indLastNumbMPC+1))>=0) // YES ! 
			  {
			    memcpy(&myAst[ind].taxClasses[20],&ast.taxClasses[20],3);
			    myAst[ind].hasTax=1;
			    myAst[ind].refs[6]+=DEMEOCARRY;
			  }
			else
			  {
			    cout << ">>match FAILED  " << ast.Designation << "--" << line << endl;
			  }
		      }
		  }
	      }
	  }
     }
    myfile.close();
  }
  else cout << "Unable to open file"; 
}
